home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_quik.lha / quickdraw / src / query_calls.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-09  |  2.3 KB  |  133 lines

  1. /*------------------------------ query_calls.c -------------------------------*/
  2. /* Copyright 1989 Brown University -- Jeffrey Vogel                           */
  3. /*----------------------------------------------------------------------------*/
  4.  
  5. /*--------------------------------- Includes ---------------------------------*/
  6. /*----------------------------------------------------------------------------*/
  7.  
  8. #include "qd_local.h"
  9.  
  10.  
  11.  
  12.  
  13. /*---------------------------------- Button ----------------------------------*/
  14. /*----------------------------------------------------------------------------*/
  15.  
  16. Boolean
  17. Button()
  18. {
  19.    Window  child, root;
  20.    int     rx, ry, x, y;
  21.    unsigned int keys, mask;
  22.    XWindowAttributes  atts;
  23.  
  24.    /*** error checks ***/
  25.    if (!QDrunning) {
  26.       QDerror("ERROR Button: QuickDraw not initialized.");
  27.       return FALSE;
  28.    }
  29.  
  30.    /*** make sure we have the latest sizes ***/
  31.    XGetWindowAttributes(QDdisplay, QDwindow, &atts);
  32.    QDwidth = atts.width;
  33.    QDheight = atts.height;
  34.  
  35.    mask = (Button1Mask|Button2Mask|Button3Mask);
  36.    XQueryPointer(QDdisplay, QDwindow, &root,
  37.                  &child, &rx, &ry, &x, &y, &keys); 
  38.    if ((x < 0) || (y < 0) || (x > QDwidth) || (y > QDheight))
  39.       return FALSE;
  40.    else 
  41.       return ((keys & mask) != 0);
  42. }
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. /*--------------------------------- GetMouse ---------------------------------*/
  68. /*----------------------------------------------------------------------------*/
  69.  
  70. void
  71. GetMouse(x, y)
  72. int  *x, *y;
  73. {
  74.    Window  child, root;
  75.    int     rx, ry;
  76.    unsigned int keys;
  77.  
  78.    /*** error checks ***/
  79.    if (!QDrunning) {
  80.       QDerror("ERROR GetMouse: QuickDraw not initialized.");
  81.       return;
  82.    }
  83.  
  84.    XQueryPointer(QDdisplay, QDwindow, &root,
  85.                  &child, &rx, &ry, x, y, &keys); 
  86. }
  87.  
  88. /*-------------------------------- GetMousePt --------------------------------*/
  89. /*----------------------------------------------------------------------------*/
  90.  
  91. void
  92. GetMousePt(pt)
  93. Point   *pt;
  94. {
  95.    Window  child, root;
  96.    int     rx, ry;
  97.    unsigned int keys;
  98.  
  99.    /*** error checks ***/
  100.    if (!QDrunning) {
  101.       QDerror("ERROR GetMousePt: QuickDraw not initialized.");
  102.       return;
  103.    }
  104.  
  105.    XQueryPointer(QDdisplay, QDwindow, &root,
  106.                  &child, &rx, &ry, &(pt->x), &(pt->y), &keys); 
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.